<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp" %>
<!DOCTYPE HTML>
<html ng-app>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    <title>${title}</title>
    <%@ include file="/WEB-INF/jsp/commons/meta.jsp" %>
    <link href="${ctx}/resources/new/style.css" type="text/css" rel="stylesheet"/>

</head>
<body>
<script>
    $(document).ready(function () {
        //聚焦第一个输入框
        $("#name").focus();
        //为inputForm注册validate函数
        $("#inputForm").validate({
            rules: {
                interview: "required",
                content: "required",
                interTime: "required",
                interUser: "required",
                department: "required",
                brand: "required",
                interFlag: "required",
                // interFailureReason : "required",
                // interNextCallBack : "required",
                // memo : "required"
            }
        });

        $(".datepicker").datepicker({
            dateFormat: "yy-mm-dd",
            monthNames: [ "- 01月", "- 02月", "- 03月", "- 04月", "- 05月", "- 06月", "- 07月", "- 08月", "- 09月", "- 10月", "- 11月", "- 12月" ],
            showMonthAfterYear: true
        });

        //$("#reasonTR").hide();
        $("#interFlag1").click(function () {
            $("#reasonTR").hide();
            $("#interFailureReason").val("");
        });
        $("#interFlag2").click(function () {
            $("#reasonTR").show();
        });


    });
</script>
<form:form id="inputForm" class="well form-inline" action="${ctx}/adoms/consumerInterviewDetail/save"
           modelAttribute="consumerInterviewDetail" method="POST">
    <form:hidden path="id"/>
    <table class="table table-striped table-bordered table-condensed">
        <thead>
        <i class="icon-flag"></i>
        <strong>消费者回访详情表单</strong>
        </thead>
        <tr>
            <td>所属记录:</td>
            <td><form:select path="interview.id">
                <c:forEach items="${interviews}" var="row">
                    <form:option value="${row.id}">${row.department.name}采访${row.consumer.fullName}</form:option>
                </c:forEach>
            </form:select></td>
        </tr>
        <tr>
            <td>回访内容:</td>
            <td><form:input path="content" size="30" maxlength="80"/></td>
        </tr>
        <tr>
            <td>回访时间:</td>
            <td><form:input path="interTime" cssClass="datepicker" size="30" maxlength="80"/></td>
        </tr>
        <tr>
            <td>电访员:</td>
            <td><form:input path="interUser" size="30" maxlength="80"/></td>
        </tr>
        <tr>
            <td>购买门店:</td>
            <td><form:select path="department.id">
                <form:options items="${departments}" itemLabel="name" itemValue="id" size="30" maxlength="80"/>
            </form:select></td>
        </tr>
        <tr>
            <td>食用品牌:</td>
            <td><form:select path="brand.id">
                <form:options items="${brands}" itemLabel="name" itemValue="id" size="30" maxlength="80"/>
            </form:select></td>
        </tr>
        <tr>
            <td>是否回访成功:</td>
            <td>
                <form:radiobutton path="interFlag" label="是" value="true"/>
                <form:radiobutton path="interFlag" label="否" value="false"/>
            </td>
        </tr>
        <c:if test="${!consumerInterviewDetail.interFlag}">
            <tr id="reasonTR">
                <td>未成功回访原因:</td>
                <td><form:input path="interFailureReason" size="30" maxlength="80"/></td>
            </tr>
        </c:if>
        <c:if test="${consumerInterviewDetail.interFlag}">
            <tr id="reasonTR" style="display:none;">
                <td>未成功回访原因:</td>
                <td><form:input path="interFailureReason" size="30" maxlength="80"/></td>
            </tr>
        </c:if>
        <tr>
            <td>预约下次回访时间:</td>
            <td><form:input path="interNextCallBack" cssClass="datepicker" size="30" maxlength="80"/></td>
        </tr>
        <tr>
            <td>备注:</td>
            <td><form:textarea path="memo" rows="4" cssClass="span6"/></td>
        </tr>
        <tr>
            <td colspan="2">
                <input class="btn" type="submit" value="提交"/>
                &nbsp;
                <input class="btn" type="button" value="返回" back="back" onclick="history.go(-1)"/>
            </td>
        </tr>
    </table>
</form:form>
</body>
</html>